//
//  IMonoAudioFileReader.h
//  FilterModule_Standalone
//
//  Created by kadlubek47 on 07.08.2013.
//  Copyright (c) 2013 kadlubek47. All rights reserved.
//

#ifndef LowPassFilter_Standalone_IMonoAudioFileReader_h
#define LowPassFilter_Standalone_IMonoAudioFileReader_h

#include "FilterModuleTypes.h"

//AudioFileIOManager
#include "IAudioFileIOManager.h"
#include "AudioFileIOManager_libsndfile.h"


class MonoAudioFileReader {
public:
    MonoAudioFileReader() {
        
    }
    ~MonoAudioFileReader() {
        delete &fileIOManager_;
    }
    
    void read(const char* pathToFile, float_type** destiny, unsigned int* length) {
        void** channels;
        int numOfChannels;
        unsigned int sampleRate;
        long long length2;
        fileIOManager_.read(pathToFile, sizeof(float_type), &length2, &channels, &numOfChannels, &sampleRate);
        *length = (unsigned int) length2;
        *destiny = (float_type*)channels[0];
    }
    
private:
    IAudioFileIOManager& fileIOManager_ = *new AudioFileIOManager_libsndfile();
};


#endif
